import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';

export const FormColumns = (self, menudict) => [
  {
    title: '部门',
    name: 'caption',
    tableItem: {},
    formItem: {  //定义update
      rules: [
        {
          required: true,
          message: '请输入名称'
        }
      ]
    }
  },
    {
    title: '所属菜单',
    name: 'menu',
    dict: menudict,
    tableItem: {},
    formItem: {  //定义update
      type:'select',
       group: 'abc',
      rules:[
          {
            required: true,
            message: '请选择所属菜单'
          }
      ]
    }
  },
  {
    title: '操作',
    tableItem: {
      width: 100,
      fixed: 'right',
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit" />
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash" />
          </Button>
        </DataTable.Oper>
      )
    }
  }
];
